﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>按照sql计算</title>
    <!--SQL编辑器-->
    <link href="../../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <link href="../../../Scripts/CodeMirror/addon/hint/show-hint.css" rel="stylesheet" />
    <script src="../../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <script src="../../../Scripts/CodeMirror/mode/sql/sql.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/hint/show-hint.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/hint/sql-hint.js"></script>
    <script src="../../../LoadSql.js"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../../../Scripts/vue.js" type="text/javascript"></script>
</head>
<body>
    <div id="App">
        <div id="bar">
        </div>
        <fieldset>
            <legend>请在文本框里输入SQL.</legend>
            <br />
            <textarea id="TB_SQL"  class="SQL" style="width: 95%; height: 50px" v-model="sql"></textarea>
        </fieldset>

        <fieldset>
            <legend id="help">说明</legend>
            <ul>
                <li>该SQL是需要返回No,Name两个列，分别是人员编号,人员名称。</li>
                <li>
                    SQL语句支持ccbpm表达式, 比如：SELECT No,Name FROM Port_Emp WHERE FK_Dept='@WebUser.FK_Dept'
                </li>
                <li>
                    比如：SELECT No,Name FROM Port_Emp WHERE FK_Dept='@MyFieldName' MyFieldName 必须是节点表单字段.
                </li>
                <li>什么是ccbpm表达式，请百度：ccbpm 表达式</li>
                <li><a href="javascript:LoadTemplate();">我要从模版里选择一个设置.</a></li>
            </ul>
        </fieldset>
    </div>
    <script type="text/javascript">
        var Baseinfo = new Vue({
            el: '#App',
            data: {
                deliverWay: DeliveryWay.BySQL,
                sql: '',
                nodeId:GetQueryString("FK_Node")
            },
            created() {
                InitBar(this.deliverWay);
                var node = new Entity("BP.WF.Node", this.nodeId);
                if (node.DeliveryWay == DeliveryWay.BySQL) {

                    this.sql = node.DeliveryParas;
               
                    
                }
            }
        });
         function Save() {
            var node = new Entity("BP.WF.Node", Baseinfo.nodeId);
            node.DeliveryWay =Baseinfo.deliverWay;
            if (CheckIsSQL(editor.getValue()) == false) {
                alert("请输入合法的SQL.");
                return;
            }

            node.DeliveryParas = editor.getValue();
            node.Update();
        }
    </script>
</body>
</html>
